<?php

namespace app\api\controller;

use app\BaseController;
use think\facade\Request;
use app\Response;
class Test extends BaseController
{

    /**
     * 版本号存储
     */
    public function writeVersion(){
        $version = Request::param("version");
        $file_name ="/usr/local/nginx/html/express_refund_order/public/uploads/api/writeVersion.txt";
        $fz = file_exists($file_name);$file_pointer = fopen($file_name,"w");
        fwrite($file_pointer,$version);
        fclose($file_pointer);
        return Response::wrapData();
    }

    /**
     * 版本号获取
     */
    public function getVersion(){
        $file_name ="/usr/local/nginx/html/express_refund_order/public/uploads/api/writeVersion.txt";
        $fz = file_exists($file_name);
        $version = "";
        if($fz){
            $fp=fopen($file_name,'r');
            while(!feof($fp))
            {
                $version=fgets($fp,4096);
            }
            fclose($fp);
        }
        return Response::wrapData($version);
    }


    public function test(){
        echo phpinfo();exit;
    }
}